package com.maple.utils.const

import android.app.Application
import android.os.Debug
import com.blankj.utilcode.BuildConfig
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.ToastUtils
import com.blankj.utilcode.util.Utils
import com.elvishew.xlog.LogConfiguration
import com.elvishew.xlog.LogLevel
import com.elvishew.xlog.XLog
import com.elvishew.xlog.XLog.disableBorder
import com.elvishew.xlog.XLog.disableThreadInfo
import com.elvishew.xlog.XLog.enableBorder
import com.elvishew.xlog.XLog.logLevel
import com.elvishew.xlog.XLog.tag
import com.maple.provider.ContextProvider
import com.tencent.mmkv.MMKV
import me.bzcoder.easyglide.EasyGlide
import kotlin.properties.Delegates

class UtilsInit{

    companion object {
        @JvmStatic
        lateinit var packageName: String
            private set


        fun init(packageName: String) {
            val app = ContextProvider.appContext
            this.packageName = packageName
            initLog(app)
            Utils.init(app)
            SPUtils.getInstance(packageName)
            MMKV.initialize(app)

            EasyGlide.placeHolderImageView = com.maple.res.R.drawable.ic_default_errorpic
            EasyGlide.circlePlaceholderImageView = com.maple.res.R.drawable.ic_default_placeholder
        }

        private fun initLog(app: Application) {
            val config = LogConfiguration
                .Builder()
                .logLevel(LogLevel.ALL)
                .tag("GGQ")
                .build()
            XLog.init(config)
        }
    }
}